<div>
    <fieldset>
        <legend>Арибута изданий</legend>
        <div id="FieldList"><?php echo $this->FieldList()->ToHtml(); ?></div>

        <div class="PageMenu">
            <input type="button" id="AddFieldDialog" value="Добавить"/>
            <input type="button" id="AltFieldDialog" value="Изменить"/>
<!--            <input type="button" id="ViewDict" value="Словарь"/>-->
        </div>
    </fieldset>


    <script type="text/javascript">
        jsun.run(function() {
        //////////////////////////////////////////////////////

        jsun("#AddFieldDialog").jsun.event({ onclick: AddField });
        jsun("#AltFieldDialog").jsun.event({ onclick: AltField });

        function ViewDict() {
            var pref = "ViewDict",
                req = "u=Lib&p=Lib\\DictPage&FieldId="
                    + jsun("#FieldListSelect").value;

            jsun.swap[pref].Page = 1;
            jsun.swap[pref].Req = req;
            //jsun.swap[pref]["Start"]();
        }

        function AltField() {
            var val = jsun("#FieldListSelect").value;
            if (!val) return true;

            var param = "u=Lib&m=Lib\\Field/Alt"
                + "&field_id=" + val;

            var dlg = new jsun.dialog({ title: 'Изменить поле описания' });
            jsun.html.insert(dlg.content.v, jsun.html.sync_load(param));
            return dlg.show();
        }

        function AddField() {
            var dlg = new jsun.dialog({ title: 'Новое поле описания' });
            jsun.html.insert(dlg.content.v, jsun.html.sync_load("u=Lib&m=Lib\\Field/Add"));
            return dlg.show();
        }

        ///////////////////////////////////////////////////////
        });
    </script>
</div>